/**  
 * All rights Reserved, Designed By daiw
 * @Title:  SwaggerController.java   
 * @Package org.component.integration.samples.swagger   
 * @Description:    TODO (用一句话描述该文件做什么)   
 * @author: daiw     
 * @date:   2019年10月15日 下午5:35:18   
 * @Copyright: 2019 daiw Inc. All rights reserved. 
 */
package org.component.integration.samples.swagger;

import java.util.ArrayList;
import java.util.List;

import org.easyframework.core.entity.ResponseResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @ClassName: SwaggerController
 * @Description: TODO (这里用一句话描述这个类的作用)
 * @author: daiw
 * @date: 2019年10月15日 下午5:35:18
 */
@Api("swagger test")
@RestController
@RequestMapping(value = "swagger")
public class SwaggerController {

	@ApiOperation(value = "显示列表", notes = "获取所有用户信息")
	@RequestMapping(value = "show", method = RequestMethod.POST)
	@ResponseBody
	public ResponseResult<List<SwaggerEntity>> show(@RequestBody SwaggerQueryParam queryParam) {
		List<SwaggerEntity> entities = new ArrayList<SwaggerEntity>();
		for (int i = 0; i < 5; i++) {
			entities.add(createMockData());
		}
		return ResponseResult.getSuccess(entities);
	}

	private SwaggerEntity createMockData() {
		SwaggerEntity entity = new SwaggerEntity();
		entity.setAge(12);
		entity.setDepartment("开发部");
		entity.setPassword("******");
		entity.setUserName("jacky");
		SwaggerSubEntity swaggerSubEntity = new SwaggerSubEntity();
		swaggerSubEntity.setAddress("xxx街道123号");
		swaggerSubEntity.setPhone("13800000000");
		entity.setSwaggerSubEntity(swaggerSubEntity);
		return entity;
	}

}
